﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.MonthCalendar;

namespace _2_1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                double radius = Convert.ToDouble(txtRadius.Text);
                double area = Math.PI * radius * radius;
                double perimeter = 2 * Math.PI * radius;

                txtArea.Text = area.ToString("F2");
                txtPerimeter.Text = perimeter.ToString("F2");
            }
            catch (Exception ex)
            {
                MessageBox.Show("请输入有效的数字！");
            }
        }
    }
}
